#pragma once

#include "sqlite3.h"

namespace SQLite {

	ref class Statement;

	public ref class Database sealed {
		friend Statement;
	private:
		sqlite3* db;
	public:
		property bool Ready;
		Database(Platform::String^ name) {
			auto path = Windows::Storage::ApplicationData::Current->LocalFolder->Path + "\\" + name;
			int rc = sqlite3_open16(path->Data(), &db);
			Ready = rc == SQLITE_OK;
		}
		~Database() {
			if (db != nullptr) sqlite3_close(db);
		}
		Statement^ PrepareStatement(Platform::String^ cmd);
	};

}
